package server

import (
	"github.com/gin-gonic/gin"
	"github.com/gin-contrib/cors"
	log "github.com/sirupsen/logrus"
	"conf"
)

func StartWebService(config *conf.Config) {
	log.Infof("webserver: %s", config.ListenURL)

	gin.SetMode(gin.ReleaseMode)
	
	router := gin.Default()

	router.Use(cors.Default())
	// Register forward api
	routerGroup := router.Group("/v1")

	registerRouter(routerGroup, config)

	router.Run(config.ListenURL)

}